package com.ddtj.demo1.service.impl;

import com.ddtj.demo1.dao.BookRepository;
import com.ddtj.demo1.entity.Book;
import com.ddtj.demo1.service.IBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class BookServiceImpl implements IBookService {
    @Autowired
    BookRepository bookRepository;
    @Override
    public List<Book> findAll(Book book) {
        List<Book> like = bookRepository.findBookByNameIsLikeAndAuthorIsLike(book);
        return like;
    }

    @Override
    public void save(Book book) {
        bookRepository.save(book);
    }

    @Override
    public void update(Book book) {
        bookRepository.save(book);
    }

    @Override
    public void delete(Book book) {
        bookRepository.delete(book);
    }

    @Override
    public Page findPage(Pageable pageable, Book book) {
        bookRepository.findAll(pageable);
        return null;
    }
}
